package com.pro.controller;

import com.pro.pojo.JsCourseRecord;
import com.pro.pojo.JsonData;
import com.pro.service.JsCourseRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:JsCourseRecordController
 * Package:com.pro.controller
 * Description:
 *
 * @Date:2022/1/13 20:39
 * @Author: ZPT
 */
@RestController
@RequestMapping("/record")
public class JsCourseRecordController {
    @Autowired
    private JsCourseRecordService courseRecordService;
    /**
     *
     * @author ZPT
     * @date 2022/1/13 20:36
     * @content :添加审核
     */
    @RequestMapping("/addRecord")
    public JsonData addRecord(JsCourseRecord courseRecord){
        Boolean addBoolean = courseRecordService.addRecord(courseRecord);
        return addBoolean!=null?JsonData.buildSuccess(addBoolean):JsonData.buildError("服务端错误");
    }
    /**
     *
     * @author ZPT
     * @date 2022/1/14 16:15
     * @content :查询课程审核数据
     */
    @RequestMapping("/getRecord")
    public JsonData getRecord(JsCourseRecord courseRecord){
        List<JsCourseRecord> recordList = courseRecordService.getRecord(courseRecord);
        return recordList!=null?JsonData.buildSuccess(recordList):JsonData.buildError("服务端错误");
    }
    /**
     *
     * @author ZPT
     * @date 2022/1/14 18:43
     * @content :查询各个状态对应的数量
     */
    @RequestMapping("/recordCount")
    public JsonData recordCount(String result,Integer type){
        Integer recordCount = courseRecordService.recordCount(result, type);
        return recordCount!=null?JsonData.buildSuccess(recordCount):JsonData.buildError("服务端错误");
    }
    /**
     *
     * @author ZPT
     * @date 2022/1/14 20:47
     * @content :修改审核结果
     */
    @RequestMapping("/updateRecordResult")
    public JsonData updateRecordResult(JsCourseRecord courseRecord){
        Boolean updateRecordResultBoolean = courseRecordService.updateRecordResult(courseRecord);
        return updateRecordResultBoolean!=null?JsonData.buildSuccess(updateRecordResultBoolean):JsonData.buildError("服务端错误");
    }
    /**
     *
     * @author ZPT
     * @date 2022/1/15 9:52
     * @content :查看微圈审核数据
     */
    @RequestMapping("/getMicrocircleRecord")
    public JsonData getMicrocircleRecord(JsCourseRecord courseRecord){
        List<JsCourseRecord> microcircleRecordList = courseRecordService.getMicrocircleRecord(courseRecord);
        return microcircleRecordList!=null?JsonData.buildSuccess(microcircleRecordList):JsonData.buildError("服务端错误");
    }
    /**
     *
     * @author ZPT
     * @date 2022/1/19 18:05
     * @content :删除审核数据
     */
    @RequestMapping("/deleteRecord")
    public JsonData deleteRecord(Integer courseId,Integer type){
        Boolean deleteRecordBoolean = courseRecordService.deleteRecord(courseId, type);
        return deleteRecordBoolean!=null?JsonData.buildSuccess(deleteRecordBoolean):JsonData.buildError("服务端错误");
    }
}
